window.onload=function(){
		var spanCode=document.getElementById("yzm");
		spanCode.innerHTML = Rnd();
		//随机验证码
		function Rnd(){
		var str = "abcdefghijklmnopqrstuvwxyz0123456789";
		var arr = str.split("");
		var l = arr.length;
		var i1 = Math.floor(Math.random()*l);
		var i2 = Math.floor(Math.random()*l);
		var i3 = Math.floor(Math.random()*l);
		var i4 = Math.floor(Math.random()*l);
		return arr[i1]+arr[i2]+arr[i3]+arr[i4];
		console.log(arr);
	};

		var btn1=document.getElementById("btn");
			btn1.onclick=function(){
					var username1=document.getElementById("username").value;
					var password1=document.getElementById("password").value;
					var username=getCookie("username");
					console.log(username);
					var password=getCookie("password");
					if((username1==username)&&password1==password&&username1!==""&&password1!==""){
						alert("登陆成功");
						window.location.href="./index.html";
							}else{
								alert("用户名密码错误")
							};
					
		}
	}